package zhongxin;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;


public class SocketTest {
	private static ServerSocket serverSocket;
	
	public static void main(String[] args) throws IOException{
		serverSocket = new ServerSocket(3000);
		
		Socket client = serverSocket.accept();
		
		BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
		PrintWriter out = new PrintWriter(client.getOutputStream());
		String text;
		while((text = in.readLine())!=null){
			out.println(text);
			out.flush();
		}
		in.close();
		out.close();
		serverSocket.close();
	}

}
